package com.example.demo.mapper;

import com.example.demo.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("select * from student where id = #{id}")
    Student findById(Long id);

    @Select("select * from student")
    //查询所有学生
    List<Student> findAll();

    @Insert("insert into student(name,height,weight) values(#{name},#{height},#{weight})")
    int insert(Student student);

    @Delete("delete from student where id = #{id}")
    int deleteById(Long id);

    @Update("update student set name = #{name},height = #{height},weight = #{weight} where id = #{id}")
    int update(Student student);

    @Update("update student set id=#{student.id},name = #{student.name},height = #{student.height},weight = #{student.weight} where id = #{my_id}")
    int updateWithId(Long my_id,Student student);

}
